/**
 * Created by qunxing.du on 2016/7/13.
 * Copyright 2016 汉威.智慧环保事业部 Limited.
 * All rights reserved.
 */
package com.hw.one.collect.zzcity.job;

import com.hw.one.collect.job.Job;
import com.hw.one.collect.zzcity.ZzCityClient;
import org.apache.log4j.Logger;

import java.util.Map;

/**
 *  郑州市站数据拉取顶层job
 */
public abstract class ZzCityJob extends Job{
    private static Logger log = Logger.getLogger(ZzCityJob.class);
    //拉取时间间隔
    protected static int RAW_RT_INTERVAL = 5;//分
    protected static int RAW_FIVEMIN_INTERVAL = 5;//分
    protected static int RAW_ONEHOUR_INTERVAL = 1;//小时
    protected static int RAW_DAYAVG_INTERVAL = 12;//小时
    protected static int AUDIT_ONEHOUR_INTERVAL = 1;//小时
    protected static int AUDIT_DAYAVG_INTERVAL = 12;//小时
    //数据类型
    protected static final String RAW = "1";//原数据
    protected static final String AUDIT = "0";//审核数据
    //数据类型
    protected static final String RAW_RT_DATATYPE = "0";
    protected static final String RAW_FIVEMIN_DATATYPE = "1";
    protected static final String RAW_ONEHOUR_DATATYPE = "2";
    protected static final String RAW_DAYAVG_DATATYPE = "3";
    protected static final String AUDIT_RT_DATATYPE = "0";
    protected static final String AUDIT_FIVEMIN_DATATYPE = "1";
    protected static final String AUDIT_ONEHOUR_DATATYPE = "2";
    protected static final String AUDIT_DAYAVG_DATATYPE = "3";
    //容错拉取时间间隔
    protected static int RT_FAULT_TOLERANT_INTERVAL = 5;//分
    protected static int FIVEMIN_FAULT_TOLERANT_INTERVAL = 5;//分
    protected static int ONEHOUR_FAULT_TOLERANT_INTERVAL = 10;//分
    protected static int DAYAVG_FAULT_TOLERANT_INTERVAL = 60;//分
    /**
     * 参数 "startTime=2016-06-22 12:00:00&endTime=2016-06-23 12:00:00&dataType=0&isSrc=1";
     * @param map
     */
    protected void execute(Map<String,String> map){
        try {
            log.info(this.getClass().getSimpleName() + "执行开始");
            ZzCityClient client = new ZzCityClient();
            //执行
            client.execute(map);

        } catch (Exception e) {
            e.printStackTrace();
            log.info("失败原因：" + e.getMessage());
        }
        log.info(this.getClass().getSimpleName() + "执行结束");
    }

}
